#cloud-config

# Hostname management
preserve_hostname: False
hostname: lb.{{ cluster_name }}.{{ network_domain }} #update
fqdn: lb.{{ cluster_name }}.{{ network_domain }}

# Yum Repository
#yum_repos:
#  epel:
#    name: Extra Packages for Enterprise Linux 7 - $basearch
#    baseurl: http://download.fedoraproject.org/pub/epel/7/$basearch
#    metalinkr: https://mirrors.fedoraproject.org/metalink?repo=epel-7&arch=$basearch
#    failovermethod: priority
#    enabled: 1
#    gpgcheck: 0
#    gpgkey: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
#  epel-debuginfo:
#    name: Extra Packages for Enterprise Linux 7 - $basearch - Debug
#    baseurl: http://download.fedoraproject.org/pub/epel/7/$basearch/debug
#    metalink: https://mirrors.fedoraproject.org/metalink?repo=epel-debug-7&arch=$basearch
#    failovermethod: priority
#    enabled: 1
#    gpgkey: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
#    gpgcheck: 0


# Default Packages
{% if install_packages is defined %}
packages:
  {% for package in install_packages -%}   
  - {{ package }}
  {% endfor -%} 
{% endif %} 

# Groups
groups:
  - docker

# Users
users:
  - default
  - name: ocp
    ssh_authorized_keys:
    - {{ ssh_public_key }}
    groups: docker
    sudo: ['ALL=(ALL) NOPASSWD:ALL']

# Change password (Reference Only)
ssh_pwauth: True
password: redhat
chpasswd:
  list: |
    ocp:admin
    root:admin
  expire: False

# Remove cloud-init when finished with it
runcmd:
  - [ yum, -y, remove, cloud-init ]
  - systemctl restart sshd

# Configure where output will go
output:
  all: ">> /var/log/cloud-init.log"

# configure interaction with ssh server
ssh_svcname: ssh
ssh_deletekeys: True
#ssh_genkeytypes: ['rsa', 'ecdsa']

# Install my public ssh key to the first user-defined user configured
# in cloud.cfg in the template (which is centos for CentOS cloud images)
ssh_authorized_keys:
  - {{ ssh_public_key }}

#power_state:  
# delay: "now"  
# mode: reboot
